<? $this->title='Products'; ?>
{{wrap with="admin_page_layout.phtml" in="content_zone"}}

<a href='{{route_url params="action:create"}}'>Create new product</a>
<p/>

<? $products = lmbActiveRecord :: find('Product'); ?>

{{paginate iterator='$products' pager='pager' /}}

{{include file='pager.phtml'/}}

<form name='list_form' method='post'>
{{list using="$products"}}
<table cellpadding="0" cellspacing="0" class='list' width='100%'>
  <thead>
  <tr>
    <th>Select</th>
    <th>Title/Image/Price/Description</th>
    <th>Actions</th>
  </tr>
  </thead>
  {{list:item}}
  <tr>
   <td>
    <input type='checkbox' name='ids[]' value='{$item.id}' class='input'/>
    <? if($item->getIsAvailable()) { ?>
      <img src='images/available.gif' class=''/>
    <? } else { ?>
      <img src='images/not_available.gif'/>
    <? } ?>
   </td>
   <td>
      <dl>
        <dt>
          <b>{$item.title}</b><br />
          Price:<b>{$item.price}</b><br/>

         </dt>
         <dd>
            <img src='{$item.image_path}' class='img'/>
            {$item.description|nl2br}
         </dd>
      </dl>

   </td>

   <td>
     <a href='{{route_url params="action:edit,id:{$item.id}"}}'>Edit</a>&nbsp;
     <a href='{{route_url params="action:delete,id:{$item.id}"}}'>Delete</a>
   </td>
  </tr>
  {{/list:item}}
</table>
{{/list}}
<input type='hidden' name='action' value='change_availability'/>
<input type='submit' name='set_available' value='Set available'/>
<input type='submit' name='set_not_available' value='Set not available'/>
</form>

{{/wrap}}
